<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="Content-Type" content="text/html; charset=gbk">
    <title>个人注册</title>
    <link rel="icon" href="//www.jd.com/favicon.ico"/>
    <link type="text/css" rel="stylesheet" href="//misc.360buyimg.com/jdf/1.0.0/unit/??ui-base/1.0.0/ui-base.css">
    <link type="text/css" rel="stylesheet" href="//misc.360buyimg.com/user/reg/3.0.0/css/tinyscrollbar-170524.css">
    <link source="widget" type="text/css" rel="stylesheet" href="//misc.360buyimg.com/user/reg/3.0.0/widget/??/header/header.css,/common/common.css,/progress-bar/progress-bar.css,/reg-steps/reg-steps.css,/foreign-number-layer-170524/foreign-number-layer-170524.css,/footer/footer.css">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-table.min.css">
    <script type="text/javascript" src="/js/jquery-easyui-1.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="/js/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/js/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/js/jquery-easyui-1.4.1/insdep.extend.min.js"></script>
    <script type="text/javascript" src="/js/common.js"></script>
</head>
<body>
<div class="header">
    <div class="logo-con w clearfix">
        <a href="" class="logo">
        </a>
        <div class="logo-title">欢迎注册</div>

        <div class="have-account">已有账号？ <a href="/user/login.html">请登录&gt;</a></div>

    </div>
</div>
<div class="col-md-12">
    <div class="col-md-4"></div>
    <div class="col-md-4">
        <div style="padding: 100px 100px 10px;">
        <form class="bs-example bs-example-form" role="form" action="/user/register" method="post">
            <div class="input-group">
                <span class="input-group-addon" id="sizing-addon1" >用&ensp;户&ensp;名</span>
                <input type="text" class="form-control" maxlength="20" placeholder="您的账户名和登录名" id="username" onblur="checkUserName(this.value)">
                <span id="code_msg" style="color: red"></span>
            </div>
            <br>
            <br>
            <div class="input-group">
                <span class="input-group-addon" id="sizing-addon2" >设置密码</span>
                <input type="password" class="form-control" maxlength="20" placeholder="建议使用两种或两种以上字符组合" id="password1" >
            </div>
            <br>
            <br>
            <div class="input-group">
                <span class="input-group-addon" id="sizing-addon3" >确认密码</span>
                <input type="password" class="form-control" placeholder="请再次输入密码" id="password2" >
            </div>
            <br>
            <br>
            <div class="input-group">
                <span class="input-group-addon" id="sizing-addon4" >手&ensp;机&ensp;号</span>
                <input type="text" class="form-control" placeholder="请输入手机号" id="phone">
            </div>
            <br>
            <br>
            <div class="input-group">
                <span class="input-group-addon" id="sizing-addon5" >邮&ensp;箱&ensp;号</span>
                <input type="text" class="form-control" placeholder="请输入邮箱号" id="email"  default="<i class='i-def'></i>请输入您当前使用的邮箱号">
            </div>
            <br>
            <br>
            <div>
                <button  id="register_btn" type="button" style="width: 100%;height: 40px;background-color: #a94442;color: white"  >立即注册</button>
            </div>
        </form>
        </div>
        </div>
        <div class="col-md-4"></div>

</div>
<div  class="footer w"  style="padding-top: 600px">
    <div class="links" >
        <hr>
        <a rel="nofollow" target="_blank" href="//www.jd.com/intro/about.aspx"> 关于我们</a>|
        <a rel="nofollow" target="_blank" href="//www.jd.com/contact/">联系我们</a>|
        <a rel="nofollow" target="_blank" href="//zhaopin.jd.com/">人才招聘</a>|
        <a rel="nofollow" target="_blank" href="//www.jd.com/contact/joinin.aspx">商家入驻</a>|
        <a rel="no  follow" target="_blank" href="//www.jd.com/intro/service.aspx">广告服务</a>|
        <a rel="nofollow" target="_blank" href="//app.jd.com/">手机京东</a>|
        <a target="_blank" href="//club.jd.com/links.aspx">友情链接</a>|
        <a target="_blank" href="//media.jd.com">销售联盟</a>|
        <a href="//club.jd.com/" target="_blank">京东社区</a>|
        <a href="//gongyi.jd.com" target="_blank">京东公益</a>|
        <a target="_blank" href="//en.jd.com/" clstag="pageclick|keycount|20150112ABD|9">English Site</a>
    </div>
    <div class="copyright">
        Copyright&copy;2004-2018&nbsp;&nbsp;京东JD.com&nbsp;版权所有
    </div>
</div>
</body>
<script>
    function checkUserName(obj) {
        var username = obj;
        var checkUserNameResult = document.getElementById("code_msg");
        if (username.match(/^[a-zA-Z0-9_-]{6,16}$/)) {
            checkUserNameResult.innerHTML = "";
            obj.focus();
        } else {
            checkUserNameResult.innerHTML = "请输入正确的账号";
        }
    }
</script>
<script>
    $(function () {
        $("#register_btn").click(function () {
            var username = $("#username").val();
            var password = $("#password1").val();
            var phone = $("#phone").val();
            var email =$("#email").val();
            $.ajax({
                url:"/user/showRegister",
                type:"post",
                data:{
                    "username":username,
                    "password":password,
                     "phone":phone,
                    "email":email
                },
                dataType:"json",
                success:function (rs) {
                    console.log(rs)
                    if (rs.status == 200){
                        window.location="/user/login.html"
                    }
                }

            })
        })
    })

</script>
</html>